//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS Polly service.
///
/// Amazon Polly is a web service that makes it easy to synthesize speech from text. The Amazon Polly service provides API operations for synthesizing high-quality speech from plain text and Speech Synthesis Markup Language (SSML), along with managing pronunciations lexicons that enable you to get the best results for your application domain.
public struct Polly: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the Polly client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            serviceName: "Polly",
            serviceIdentifier: "polly",
            serviceProtocol: .restjson,
            apiVersion: "2016-06-10",
            endpoint: endpoint,
            variantEndpoints: Self.variantEndpoints,
            errorType: PollyErrorType.self,
            xmlNamespace: "http://polly.amazonaws.com/doc/v1",
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }




    /// FIPS and dualstack endpoints
    static var variantEndpoints: [EndpointVariantType: AWSServiceConfig.EndpointVariant] {[
        [.dualstack]: .init(endpoints: [
            "af-south-1": "polly.af-south-1.api.aws",
            "ap-east-1": "polly.ap-east-1.api.aws",
            "ap-northeast-1": "polly.ap-northeast-1.api.aws",
            "ap-northeast-2": "polly.ap-northeast-2.api.aws",
            "ap-northeast-3": "polly.ap-northeast-3.api.aws",
            "ap-south-1": "polly.ap-south-1.api.aws",
            "ap-southeast-1": "polly.ap-southeast-1.api.aws",
            "ap-southeast-2": "polly.ap-southeast-2.api.aws",
            "ap-southeast-5": "polly.ap-southeast-5.api.aws",
            "ca-central-1": "polly.ca-central-1.api.aws",
            "cn-northwest-1": "polly.cn-northwest-1.api.amazonwebservices.com.cn",
            "eu-central-1": "polly.eu-central-1.api.aws",
            "eu-north-1": "polly.eu-north-1.api.aws",
            "eu-south-2": "polly.eu-south-2.api.aws",
            "eu-west-1": "polly.eu-west-1.api.aws",
            "eu-west-2": "polly.eu-west-2.api.aws",
            "eu-west-3": "polly.eu-west-3.api.aws",
            "me-south-1": "polly.me-south-1.api.aws",
            "sa-east-1": "polly.sa-east-1.api.aws",
            "us-east-1": "polly.us-east-1.api.aws",
            "us-east-2": "polly.us-east-2.api.aws",
            "us-gov-west-1": "polly.us-gov-west-1.api.aws",
            "us-west-1": "polly.us-west-1.api.aws",
            "us-west-2": "polly.us-west-2.api.aws"
        ]),
        [.dualstack, .fips]: .init(endpoints: [
            "ca-central-1": "polly-fips.ca-central-1.api.aws",
            "us-east-1": "polly-fips.us-east-1.api.aws",
            "us-east-2": "polly-fips.us-east-2.api.aws",
            "us-gov-west-1": "polly-fips.us-gov-west-1.api.aws",
            "us-west-1": "polly-fips.us-west-1.api.aws",
            "us-west-2": "polly-fips.us-west-2.api.aws"
        ]),
        [.fips]: .init(endpoints: [
            "ca-central-1": "polly-fips.ca-central-1.amazonaws.com",
            "us-east-1": "polly-fips.us-east-1.amazonaws.com",
            "us-east-2": "polly-fips.us-east-2.amazonaws.com",
            "us-gov-west-1": "polly-fips.us-gov-west-1.amazonaws.com",
            "us-west-1": "polly-fips.us-west-1.amazonaws.com",
            "us-west-2": "polly-fips.us-west-2.amazonaws.com"
        ])
    ]}

    // MARK: API Calls

    /// Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the GetLexicon or ListLexicon APIs. For more information, see Managing Lexicons.
    @Sendable
    @inlinable
    public func deleteLexicon(_ input: DeleteLexiconInput, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteLexiconOutput {
        try await self.client.execute(
            operation: "DeleteLexicon", 
            path: "/v1/lexicons/{Name}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the GetLexicon or ListLexicon APIs. For more information, see Managing Lexicons.
    ///
    /// Parameters:
    ///   - name: The name of the lexicon to delete. Must be an existing lexicon in the region.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteLexicon(
        name: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteLexiconOutput {
        let input = DeleteLexiconInput(
            name: name
        )
        return try await self.deleteLexicon(input, logger: logger)
    }

    /// Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice name.  When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from the list of voices returned by DescribeVoices. For example, you want your news reader application to read news in a specific language, but giving a user the option to choose the voice. Using the DescribeVoices operation you can provide the user with a list of available voices to select from. You can optionally specify a language code to filter the available voices. For example, if you specify en-US, the operation returns a list of all available US English voices.  This operation requires permissions to perform the polly:DescribeVoices action.
    @Sendable
    @inlinable
    public func describeVoices(_ input: DescribeVoicesInput, logger: Logger = AWSClient.loggingDisabled) async throws -> DescribeVoicesOutput {
        try await self.client.execute(
            operation: "DescribeVoices", 
            path: "/v1/voices", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice name.  When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from the list of voices returned by DescribeVoices. For example, you want your news reader application to read news in a specific language, but giving a user the option to choose the voice. Using the DescribeVoices operation you can provide the user with a list of available voices to select from. You can optionally specify a language code to filter the available voices. For example, if you specify en-US, the operation returns a list of all available US English voices.  This operation requires permissions to perform the polly:DescribeVoices action.
    ///
    /// Parameters:
    ///   - engine: Specifies the engine (standard, neural, long-form or generative) used by Amazon Polly when processing input text for speech synthesis.
    ///   - includeAdditionalLanguageCodes: Boolean value indicating whether to return any bilingual voices that use the specified language as an additional language. For instance, if you request all languages that use US English (es-US), and there is an Italian voice that speaks both Italian (it-IT) and US English, that voice will be included if you specify yes but not if you specify no.
    ///   - languageCode:  The language identification tag (ISO 639 code for the language name-ISO 3166 country code) for filtering the list of voices returned. If you don't specify this optional parameter, all available voices are returned.
    ///   - nextToken: An opaque pagination token returned from the previous DescribeVoices operation. If present, this indicates where to continue the listing.
    ///   - logger: Logger use during operation
    @inlinable
    public func describeVoices(
        engine: Engine? = nil,
        includeAdditionalLanguageCodes: Bool? = nil,
        languageCode: LanguageCode? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DescribeVoicesOutput {
        let input = DescribeVoicesInput(
            engine: engine, 
            includeAdditionalLanguageCodes: includeAdditionalLanguageCodes, 
            languageCode: languageCode, 
            nextToken: nextToken
        )
        return try await self.describeVoices(input, logger: logger)
    }

    /// Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
    @Sendable
    @inlinable
    public func getLexicon(_ input: GetLexiconInput, logger: Logger = AWSClient.loggingDisabled) async throws -> GetLexiconOutput {
        try await self.client.execute(
            operation: "GetLexicon", 
            path: "/v1/lexicons/{Name}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
    ///
    /// Parameters:
    ///   - name: Name of the lexicon.
    ///   - logger: Logger use during operation
    @inlinable
    public func getLexicon(
        name: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetLexiconOutput {
        let input = GetLexiconInput(
            name: name
        )
        return try await self.getLexicon(input, logger: logger)
    }

    /// Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output of the task.
    @Sendable
    @inlinable
    public func getSpeechSynthesisTask(_ input: GetSpeechSynthesisTaskInput, logger: Logger = AWSClient.loggingDisabled) async throws -> GetSpeechSynthesisTaskOutput {
        try await self.client.execute(
            operation: "GetSpeechSynthesisTask", 
            path: "/v1/synthesisTasks/{TaskId}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output of the task.
    ///
    /// Parameters:
    ///   - taskId: The Amazon Polly generated identifier for a speech synthesis task.
    ///   - logger: Logger use during operation
    @inlinable
    public func getSpeechSynthesisTask(
        taskId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetSpeechSynthesisTaskOutput {
        let input = GetSpeechSynthesisTaskInput(
            taskId: taskId
        )
        return try await self.getSpeechSynthesisTask(input, logger: logger)
    }

    /// Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
    @Sendable
    @inlinable
    public func listLexicons(_ input: ListLexiconsInput, logger: Logger = AWSClient.loggingDisabled) async throws -> ListLexiconsOutput {
        try await self.client.execute(
            operation: "ListLexicons", 
            path: "/v1/lexicons", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
    ///
    /// Parameters:
    ///   - nextToken: An opaque pagination token returned from previous ListLexicons operation. If present, indicates where to continue the list of lexicons.
    ///   - logger: Logger use during operation
    @inlinable
    public func listLexicons(
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListLexiconsOutput {
        let input = ListLexiconsInput(
            nextToken: nextToken
        )
        return try await self.listLexicons(input, logger: logger)
    }

    /// Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks by their status, for example, allowing users to list only tasks that are completed.
    @Sendable
    @inlinable
    public func listSpeechSynthesisTasks(_ input: ListSpeechSynthesisTasksInput, logger: Logger = AWSClient.loggingDisabled) async throws -> ListSpeechSynthesisTasksOutput {
        try await self.client.execute(
            operation: "ListSpeechSynthesisTasks", 
            path: "/v1/synthesisTasks", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks by their status, for example, allowing users to list only tasks that are completed.
    ///
    /// Parameters:
    ///   - maxResults: Maximum number of speech synthesis tasks returned in a List operation.
    ///   - nextToken: The pagination token to use in the next request to continue the listing of speech synthesis tasks.
    ///   - status: Status of the speech synthesis tasks returned in a List operation
    ///   - logger: Logger use during operation
    @inlinable
    public func listSpeechSynthesisTasks(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        status: TaskStatus? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListSpeechSynthesisTasksOutput {
        let input = ListSpeechSynthesisTasksInput(
            maxResults: maxResults, 
            nextToken: nextToken, 
            status: status
        )
        return try await self.listSpeechSynthesisTasks(input, logger: logger)
    }

    /// Stores a pronunciation lexicon in an Amazon Web Services Region. If a lexicon with the same name already exists in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it might take some time before the lexicon is available to the SynthesizeSpeech operation. For more information, see Managing Lexicons.
    @Sendable
    @inlinable
    public func putLexicon(_ input: PutLexiconInput, logger: Logger = AWSClient.loggingDisabled) async throws -> PutLexiconOutput {
        try await self.client.execute(
            operation: "PutLexicon", 
            path: "/v1/lexicons/{Name}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Stores a pronunciation lexicon in an Amazon Web Services Region. If a lexicon with the same name already exists in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it might take some time before the lexicon is available to the SynthesizeSpeech operation. For more information, see Managing Lexicons.
    ///
    /// Parameters:
    ///   - content: Content of the PLS lexicon as string data.
    ///   - name: Name of the lexicon. The name must follow the regular express format [0-9A-Za-z]{1,20}. That is, the name is a case-sensitive alphanumeric string up to 20 characters long.
    ///   - logger: Logger use during operation
    @inlinable
    public func putLexicon(
        content: String,
        name: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> PutLexiconOutput {
        let input = PutLexiconInput(
            content: content, 
            name: name
        )
        return try await self.putLexicon(input, logger: logger)
    }

    /// Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask. This operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket for the service to store the output of the synthesis task and two optional parameters (OutputS3KeyPrefix and SnsTopicArn). Once the synthesis task is created, this operation will return a SpeechSynthesisTask object, which will include an identifier of this task as well as the current status. The SpeechSynthesisTask object is available for 72 hours after starting the asynchronous synthesis task.
    @Sendable
    @inlinable
    public func startSpeechSynthesisTask(_ input: StartSpeechSynthesisTaskInput, logger: Logger = AWSClient.loggingDisabled) async throws -> StartSpeechSynthesisTaskOutput {
        try await self.client.execute(
            operation: "StartSpeechSynthesisTask", 
            path: "/v1/synthesisTasks", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask. This operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket for the service to store the output of the synthesis task and two optional parameters (OutputS3KeyPrefix and SnsTopicArn). Once the synthesis task is created, this operation will return a SpeechSynthesisTask object, which will include an identifier of this task as well as the current status. The SpeechSynthesisTask object is available for 72 hours after starting the asynchronous synthesis task.
    ///
    /// Parameters:
    ///   - engine: Specifies the engine (standard, neural, long-form or generative) for Amazon Polly to use when processing input text for speech synthesis. Using a voice that is not supported for the engine selected will result in an error.
    ///   - languageCode: Optional language code for the Speech Synthesis request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).  If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.
    ///   - lexiconNames: List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice.
    ///   - outputFormat: The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.
    ///   - outputS3BucketName: Amazon S3 bucket name to which the output file will be saved.
    ///   - outputS3KeyPrefix: The Amazon S3 key prefix for the output speech file.
    ///   - sampleRate: The audio frequency specified in Hz. The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000". The default value for long-form voices is "24000". The default value for generative voices is "24000". Valid values for pcm are "8000" and "16000" The default value is "16000".
    ///   - snsTopicArn: ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.
    ///   - speechMarkTypes: The type of speech marks returned for the input text.
    ///   - text: The input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text.
    ///   - textType: Specifies whether the input text is plain text or SSML. The default value is plain text.
    ///   - voiceId: Voice ID to use for the synthesis.
    ///   - logger: Logger use during operation
    @inlinable
    public func startSpeechSynthesisTask(
        engine: Engine? = nil,
        languageCode: LanguageCode? = nil,
        lexiconNames: [String]? = nil,
        outputFormat: OutputFormat,
        outputS3BucketName: String,
        outputS3KeyPrefix: String? = nil,
        sampleRate: String? = nil,
        snsTopicArn: String? = nil,
        speechMarkTypes: [SpeechMarkType]? = nil,
        text: String,
        textType: TextType? = nil,
        voiceId: VoiceId,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StartSpeechSynthesisTaskOutput {
        let input = StartSpeechSynthesisTaskInput(
            engine: engine, 
            languageCode: languageCode, 
            lexiconNames: lexiconNames, 
            outputFormat: outputFormat, 
            outputS3BucketName: outputS3BucketName, 
            outputS3KeyPrefix: outputS3KeyPrefix, 
            sampleRate: sampleRate, 
            snsTopicArn: snsTopicArn, 
            speechMarkTypes: speechMarkTypes, 
            text: text, 
            textType: textType, 
            voiceId: voiceId
        )
        return try await self.startSpeechSynthesisTask(input, logger: logger)
    }

    /// Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see How it Works.
    @Sendable
    @inlinable
    public func synthesizeSpeech(_ input: SynthesizeSpeechInput, logger: Logger = AWSClient.loggingDisabled) async throws -> SynthesizeSpeechOutput {
        try await self.client.execute(
            operation: "SynthesizeSpeech", 
            path: "/v1/speech", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see How it Works.
    ///
    /// Parameters:
    ///   - engine: Specifies the engine (standard, neural, long-form, or generative) for Amazon Polly to use when processing input text for speech synthesis. Provide an engine that is supported by the voice you select. If you don't provide an engine, the standard engine is selected by default. If a chosen voice isn't supported by the standard engine, this will result in an error. For information on Amazon Polly voices and which voices are available for each engine, see Available Voices. Type: String Valid Values: standard | neural | long-form | generative  Required: Yes
    ///   - languageCode: Optional language code for the Synthesize Speech request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).  If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.
    ///   - lexiconNames: List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. For information about storing lexicons, see PutLexicon.
    ///   - outputFormat:  The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.  When pcm is used, the content returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format.
    ///   - sampleRate: The audio frequency specified in Hz. The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000". The default value for long-form voices is "24000". The default value for generative voices is "24000". Valid values for pcm are "8000" and "16000" The default value is "16000".
    ///   - speechMarkTypes: The type of speech marks returned for the input text.
    ///   - text:  Input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text.
    ///   - textType:  Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see Using SSML.
    ///   - voiceId:  Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the DescribeVoices operation.
    ///   - logger: Logger use during operation
    @inlinable
    public func synthesizeSpeech(
        engine: Engine? = nil,
        languageCode: LanguageCode? = nil,
        lexiconNames: [String]? = nil,
        outputFormat: OutputFormat,
        sampleRate: String? = nil,
        speechMarkTypes: [SpeechMarkType]? = nil,
        text: String,
        textType: TextType? = nil,
        voiceId: VoiceId,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> SynthesizeSpeechOutput {
        let input = SynthesizeSpeechInput(
            engine: engine, 
            languageCode: languageCode, 
            lexiconNames: lexiconNames, 
            outputFormat: outputFormat, 
            sampleRate: sampleRate, 
            speechMarkTypes: speechMarkTypes, 
            text: text, 
            textType: textType, 
            voiceId: voiceId
        )
        return try await self.synthesizeSpeech(input, logger: logger)
    }
}

extension Polly {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: Polly, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension Polly {
    /// Return PaginatorSequence for operation ``listSpeechSynthesisTasks(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listSpeechSynthesisTasksPaginator(
        _ input: ListSpeechSynthesisTasksInput,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListSpeechSynthesisTasksInput, ListSpeechSynthesisTasksOutput> {
        return .init(
            input: input,
            command: self.listSpeechSynthesisTasks,
            inputKey: \ListSpeechSynthesisTasksInput.nextToken,
            outputKey: \ListSpeechSynthesisTasksOutput.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listSpeechSynthesisTasks(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: Maximum number of speech synthesis tasks returned in a List operation.
    ///   - status: Status of the speech synthesis tasks returned in a List operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listSpeechSynthesisTasksPaginator(
        maxResults: Int? = nil,
        status: TaskStatus? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListSpeechSynthesisTasksInput, ListSpeechSynthesisTasksOutput> {
        let input = ListSpeechSynthesisTasksInput(
            maxResults: maxResults, 
            status: status
        )
        return self.listSpeechSynthesisTasksPaginator(input, logger: logger)
    }
}

extension Polly.ListSpeechSynthesisTasksInput: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> Polly.ListSpeechSynthesisTasksInput {
        return .init(
            maxResults: self.maxResults,
            nextToken: token,
            status: self.status
        )
    }
}
